/*
https://leetcode.cn/problems/longest-increasing-subsequence/description/
300.最长递增子序列

*/


class Solution {
public:
    int lengthOfLIS(vector<int>& nums) {
        int n = nums.size();
        if (n == 1)
            return 1;
        int count = 1;
        vector<int> dp(n, 1);
        for (int i = 0; i < n; ++i) {
            for (int j = 0; j < i; ++j) {
                if (nums[i] > nums[j]) {
                    dp[i] = max(dp[i], dp[j] + 1);
                }
            }
            count = max(count, dp[i]);
        }
        return count;
    }
};